<?php
include "../config/connection.inc";
function getPositions(){
    $query = "select * from POSITIONS";
    return mysql_query($query);
}

function getPositionsById($id){
    $query = "select * from POSITIONS where POSITION_ID = $id";
    return mysql_fetch_array(mysql_query($query));
}

function insertPositions($position){
    $query = "INSERT INTO POSITIONS".
              " VALUES (NULL, '".$position['title']."','".$position['role']."', '".$position['descript']."')";
    $result = mysql_query($query);
    return $result;
}

function deletePosition($id){
    $query = "delete from POSITIONS where POSITION_ID = $id";
    $result = mysql_query($query);
    return $result;
}

function editPosition($position){
    $query = "update POSITIONS set 
            POSITION_TITLE = '".$position['title']."',
            POSITION_ROLE = '".$position['role']."',
            POSITION_DESCRIPTION = '".$position['descript']."'
             where POSITION_ID = '".$position['id']."'";
    $result = mysql_query($query);
    return $result;
}
?>